package com.cake.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.cake.entity.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.pagehelper.StringUtil;

public class XxAdmin extends BaseEntity {
	/**
     * 管理员主键
     * 表字段 : xx_admin.id
     */
    private Long id;

    /**
     * 管理员登录用户名
     * 表字段 : xx_admin.username
     */
    private String username;

    /**
     * 管理员登录密码
     * 表字段 : xx_admin.password
     */
    private String password;

    /**
     * 管理员邮箱地址
     * 表字段 : xx_admin.email
     */
    private String email;

    /**
     * 管理员姓名
     * 表字段 : xx_admin.name
     */
    private String name;

    /**
     * 管理员所属部门名称
     * 表字段 : xx_admin.department
     */
    private String department;

    /**
     * 管理员电话号码
     * 表字段 : xx_admin.phone
     */
    private String phone;

    /**
     * 管理员附言
     * 表字段 : xx_admin.memo
     */
    private String memo;

    /**
     * 管理员评分
     * 表字段 : xx_admin.score
     */
    private Float score;

    /**
     * 管理员总评分
     * 表字段 : xx_admin.total_score
     */
    private Long totalScore;

    /**
     * 管理员评分数
     * 表字段 : xx_admin.score_count
     */
    private Long scoreCount;

    /**
     * 管理员微信头像
     * 表字段 : xx_admin.weixin_pic
     */
    private String weixinPic;

    /**
     * 管理员是否启用
     * 表字段 : xx_admin.is_enabled
     */
    private Boolean isEnabled;

    /**
     * 管理员是否锁定
     * 表字段 : xx_admin.is_locked
     */
    private Boolean isLocked;

    /**
     * 锁定日期
     * 表字段 : xx_admin.locked_date
     */
    private Date lockedDate;

    /**
     * 连续登录失败次数
     * 表字段 : xx_admin.login_failure_count
     */
    private Integer loginFailureCount;

    /**
     * 是否为后台操作用户
     * 表字段 : xx_admin.is_back_user
     */
    private Boolean isBackUser;

    /**
     * 最后登录日期
     * 表字段 : xx_admin.login_date
     */
    private Date loginDate;

    /**
     * 最后登录ip
     * 表字段 : xx_admin.login_ip
     */
    private String loginIp;

    /**
     * 隶属于的商品主键
     * 表字段 : xx_admin.shop
     */
    private Long shop;

    /**
     * 后台人员信息创建时间
     * 表字段 : xx_admin.create_date
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createDate;

    /**
     * 后台人员信息最新修改时间
     * 表字段 : xx_admin.modify_date
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date modifyDate;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table xx_admin
     *
     * @mbg.generated
     */
    private static final long serialVersionUID = 1L;

    /**
     * 用户拥有角色
     */
    private List<XxRole> roles = new ArrayList<>();
    /**
     * 原密码
     */
    private String oldPassword;
    
    
    public String getIsEnabledName() {
    	if(null == this.isEnabled){
    		return "未启用";
    	}
		return this.isEnabled ? "已启用" : "未启用";
	}

	public String getOldPassword() {
		return oldPassword;
	}

	public void setOldPassword(String oldPassword) {
		this.oldPassword = oldPassword;
	}

	public List<XxRole> getRoles() {
		return roles;
	}

	public void setRoles(List<XxRole> roles) {
		this.roles = roles;
	}

	public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getEmail() {
        return StringUtil.isEmpty(email) ? "" : email;
    }

    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getDepartment() {
        return StringUtil.isEmpty(department) ? "" : department;
    }

    public void setDepartment(String department) {
        this.department = department == null ? null : department.trim();
    }

    public String getPhone() {
        return StringUtil.isEmpty(phone) ? "" : phone;
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo == null ? null : memo.trim();
    }

    public Float getScore() {
        return score;
    }

    public void setScore(Float score) {
        this.score = score;
    }

    public Long getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(Long totalScore) {
        this.totalScore = totalScore;
    }

    public Long getScoreCount() {
        return scoreCount;
    }

    public void setScoreCount(Long scoreCount) {
        this.scoreCount = scoreCount;
    }

    public String getWeixinPic() {
        return weixinPic;
    }

    public void setWeixinPic(String weixinPic) {
        this.weixinPic = weixinPic == null ? null : weixinPic.trim();
    }

    public Boolean getIsEnabled() {
        return isEnabled;
    }

    public void setIsEnabled(Boolean isEnabled) {
        this.isEnabled = isEnabled;
    }

    public Boolean getIsLocked() {
        return isLocked;
    }

    public void setIsLocked(Boolean isLocked) {
        this.isLocked = isLocked;
    }

    public Date getLockedDate() {
        return lockedDate;
    }

    public void setLockedDate(Date lockedDate) {
        this.lockedDate = lockedDate;
    }

    public Integer getLoginFailureCount() {
        return loginFailureCount;
    }

    public void setLoginFailureCount(Integer loginFailureCount) {
        this.loginFailureCount = loginFailureCount;
    }

    public Boolean getIsBackUser() {
        return isBackUser;
    }

    public void setIsBackUser(Boolean isBackUser) {
        this.isBackUser = isBackUser;
    }

    public Date getLoginDate() {
        return loginDate;
    }

    public void setLoginDate(Date loginDate) {
        this.loginDate = loginDate;
    }

    public String getLoginIp() {
        return loginIp;
    }

    public void setLoginIp(String loginIp) {
        this.loginIp = loginIp == null ? null : loginIp.trim();
    }

    public Long getShop() {
        return shop;
    }

    public void setShop(Long shop) {
        this.shop = shop;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) {
        this.modifyDate = modifyDate;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", username=").append(username);
        sb.append(", password=").append(password);
        sb.append(", email=").append(email);
        sb.append(", name=").append(name);
        sb.append(", department=").append(department);
        sb.append(", phone=").append(phone);
        sb.append(", memo=").append(memo);
        sb.append(", score=").append(score);
        sb.append(", totalScore=").append(totalScore);
        sb.append(", scoreCount=").append(scoreCount);
        sb.append(", weixinPic=").append(weixinPic);
        sb.append(", isEnabled=").append(isEnabled);
        sb.append(", isLocked=").append(isLocked);
        sb.append(", lockedDate=").append(lockedDate);
        sb.append(", loginFailureCount=").append(loginFailureCount);
        sb.append(", isBackUser=").append(isBackUser);
        sb.append(", loginDate=").append(loginDate);
        sb.append(", loginIp=").append(loginIp);
        sb.append(", shop=").append(shop);
        sb.append(", createDate=").append(createDate);
        sb.append(", modifyDate=").append(modifyDate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}